<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Object.defineProperty数据绑定</title>
    <script type="text/javascript" src="./js/vue.js"></script>
</head>
<div id="root">
</div>
<script type="text/javascript">
    Vue.config.productionTip = false;
    
    let person = {
        name:'张三',
        sex:'男',
    };
    let number = 18;
    Object.defineProperty(person, 'age', {
        //value: 29,
        // enumerable: true, // 可枚举
        // writable: true, // 可修改
        // configurable: true,// 可删除
        get(){ // 调用person.age时调用
            return number;
        },
        set(v){
            number = v;
        }
    });
    console.log(person)
    console.log(Object.keys(person));
</script>

</html>